﻿using System;
using System.ComponentModel;
using System.Globalization;

namespace Medicalsystem.MCP.FormDesigner.Property
{
    /// <summary>
    /// 类型转换器
    /// </summary>
    public class ContentConverter : TypeConverter//ExpandableObjectConverter
    {
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return false;
        }

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (context != null && context.Instance != null)
            {
                return (context.Instance as GetProperty).DescriptorContext(context.PropertyDescriptor.PropertyType, context.PropertyDescriptor.Name, value);
            }
            else
            {
                return base.ConvertTo(context, culture, value, destinationType);
            }
        }
    }
}